package com.zkool.system.controller;

import com.jfinal.core.Controller;
import com.jfinal.ext.route.ControllerBind;
import com.zkool.system.model.User;

@ControllerBind(controllerKey="/system/user")
public class UserController extends Controller {

	public void list(){
		setAttr("userPage", User.me.paginate(getParaToInt("pageCurrent", 1), getParaToInt("pageSize", 30)));
		render("list.html");
	}
	
	public void add() {
	}
	
	public void save() {
		getModel(User.class).save();
		redirect("/list");
	}
	
	public void edit() {
		setAttr("user", User.me.findById(getParaToInt()));
	}
	
	public void update() {
		getModel(User.class).update();
		redirect("/list");
	}
	
	public void delete() {
		User.me.deleteById(getParaToInt());
		redirect("/list");
	}
	
}
